

import lejos.nxt.*;
import lejos.robotics.navigation.DifferentialPilot;
import lejos.robotics.subsumption.*;


public class BumperCar {

	static double SIDE_SIZE = 40.0;
	static double WHEEL_DIAMETER = 5.6f;
	static double AXIS_LENGTH = 5.6f;
	
	public static void main (String[] args) throws Exception {
		
		// Navigator:
		DifferentialPilot navigator = new DifferentialPilot(WHEEL_DIAMETER, AXIS_LENGTH, Motor.A, Motor.C);
		navigator.setAcceleration(1000);
		
		// Instantiating Sensor ports:
		TouchSensor touchRight	= new TouchSensor(SensorPort.S1);
		TouchSensor touchLeft 	= new TouchSensor(SensorPort.S4);
		
		// Calibrate sensors if needed:

		Behavior b1 = new DriveForward(navigator);
		Behavior b2 = new HitWall(navigator, touchLeft, touchRight);
		Behavior [] bArray = {b1, b2};
		
		Arbitrator arby = new Arbitrator(bArray);
		arby.start();

		
//		while (true)
//		{
//			if (Button.ESCAPE.isPressed()) {
//				break;
//			}
//			
//		}

	}
}
